/**
  *@authors	Cameron Stewart, Tyler Williams, Fatimah Alowa, 
  *		Marlon Boothe,    Lauren Walker
  *@version	Group 2 Project 3 part 2
  *@since	2012-10-24
  */
  
#include <iostream>
#include "Literal.h"
#include <cstring>

/**
  * Constructor
  */
Literal::Literal(LiteralType litType){
	type=litType;
}

/**
	*sets the value to integer and type to INTEGER_LIT (or LiteralType  integer)
	*
	*@param num	integer value of literal
	*
	*@return void
	*/
void Literal::SetValue(int num){
	value.integer=num;
	type=INTEGER_LIT;
}

/**
	*sets the value to float and type to REAL_LIT (or LiteralType float)
	*
	*@param num	float value of literal
	*
	*@return void
	*/
void Literal::SetValue(float num){
	value.real=num;
	type=REAL_LIT;
}

/**
	*sets the value to string and type to STRING_LIT (or LiteralType string)
	*
	*@param str	string value of literal
	*
	*@return void
	*/
void Literal::SetValue(string str){
	strcpy(value.str,str.c_str());
	type=STRING_LIT;
}

/**
	*Gets the string value of the literal
	*
	*@return string
	*/
string Literal::GetStringValue(){
	return value.str;
}

/**
	*Gets the integer value of the literal
	*
	*@return int
	*/
int Literal::GetIntValue(){
	return value.integer;
}

/**
	*Gets the float value of the literal
	*
	*@return float
	*/
float Literal::GetFloatValue(){
	return value.real;
}

/**
	  *Gets the LiteralType of the literal
	  *
	  *@return LiteralType
	  */
LiteralType Literal::GetType(){
	return type;
}